#include<iostream> 
using namespace std;
int main()
{
    int a[1010],n,grade,i,count;
    while(cin>>n)
    {
       count=0;
       if(n==0) break;
       for(i=0;i<n;i++)
          cin>>a[i];
       cin>>grade;
       for(i=0;i<n;i++)
          if(a[i]==grade) count++;
       cout<<count<<endl;
    }
    //system("pause");
    return 0;
}
       
          
    
